'use strict';

const conn = require('../../libs/DB/Conn');
const sysMenuQueryAction = require('../../actions/sysMenu/sysMenuQueryAction');

module.exports = async function (params) {
    params.sysMenuType = 2
    let sysMenu = await sysMenuQueryAction(params);
    let getMenuDataSql = 'SELECT menus FROM user_group WHERE group_id = ?';
    let groupMenu = await conn(getMenuDataSql, [params.groupId]);
    let group = groupMenu.shift();
    let authMenu = [];
    if(group.menus){
        authMenu = group.menus.split(',')
    }
    return {success: true, data: sysMenu.data, groupMenu: authMenu};
};
